Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make transform optional for DirectPosterior. #714

Merged
merged 1 commit into from
Aug 10, 2022
Merged

make transform optional for DirectPosterior. #714

merged 1 commit into from
Aug 10, 2022

Conversation

janfb
Copy link
Contributor

@janfb janfb commented Aug 3, 2022

fixes #713

Before this PR, the DirectPosterior was constructing a theta_transform from the prior support by default and used it for maybe calculating the MAP. This can cause issues if a custom prior has a funky support.

This PR adds the theta_transform = None argument to the DirectPosterior top level so that users can pass an IdentityTransform to avoid the default construction of a transform to unconstrained space. If the argument is left None the support of the prior is used to construct a transform -- as before.

@janfb janfb force-pushed the transform-flag branch 2 times, most recently from 06aad3f to bf5bdaf Compare August 5, 2022 17:17
@codecov-commenter
Copy link

Codecov Report

Merging #714 (bf5bdaf) into main (d72fc6d) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main     #714   +/-   ##
=======================================
  Coverage   73.85%   73.85%           
=======================================
  Files          79       79           
  Lines        5970     5971    +1     
=======================================
+ Hits         4409     4410    +1     
  Misses       1561     1561           
Flag Coverage Δ
unittests 73.85% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
sbi/inference/posteriors/base_posterior.py 80.55% <ø> (-0.27%) ⬇️
sbi/inference/posteriors/direct_posterior.py 98.21% <100.00%> (ø)
.../inference/potentials/posterior_based_potential.py 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@janfb janfb marked this pull request as ready for review August 5, 2022 17:35
@janfb janfb requested a review from michaeldeistler August 5, 2022 17:36
add test

use transform for DirectPosterior as default.
@janfb janfb merged commit 91e6d26 into main Aug 10, 2022
@janfb janfb deleted the transform-flag branch August 10, 2022 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sampling without inferring the prior transform
3 participants